package com.akuma.redmine.service.impl;

import com.akuma.common.util.JsonUtils;
import com.akuma.redmine.entity.IssueQuery;
import com.akuma.redmine.entity.IssuesQuery;
import com.akuma.redmine.exception.RedMineException;
import com.akuma.redmine.service.IIssuesService;
import com.akuma.redmine.util.RedMineHttpRequest;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by akuma on 2016/10/12.
 *
 * @author akuma
 */
public class IssueServiceImpl implements IIssuesService {
    public IssueQuery get(Long id) {
        Map<String, String> params = new HashMap<String, String>();
        String s = null;
        try {
            s = RedMineHttpRequest.adminGet(params, "issues/11036.json");
        } catch (Exception e) {
            RedMineException.throwException(e);
        }
        return JsonUtils.readValue(s, IssuesQuery.class).getIssue();
    }
}
